package org.jimm.app;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class SmileAdapter extends BaseAdapter {
    private Context mContext;
    private static final Integer[] mImages = {
    		R.drawable.smile_smile,
    		R.drawable.smile_wink,
    		R.drawable.smile_sad,
    		R.drawable.smile_tongue,
            R.drawable.smile_blush,
            R.drawable.smile_cry,
            R.drawable.smile_happy,
            R.drawable.smile_hi,
            R.drawable.smile_kissed,
            R.drawable.smile_up,
            R.drawable.smile_sorry
    };
    
    public SmileAdapter(Context context) {
        mContext = context;
    }

    public int getCount() {
        return mImages.length;
    }

    public Object getItem(int position) {
        return mImages[position];
    }

    public long getItemId(int position) {
        return mImages[position];
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView view;
        if (convertView == null) {
        	view = new ImageView(mContext);
            //view.setLayoutParams(new GridView.LayoutParams(50, 50));
           // view.setAdjustViewBounds(true);
           // view.setScaleType(ImageView.ScaleType.CENTER_CROP);
          //  view.setPadding(0, 0, 0, 0);
        } 
        else {
            view = (ImageView)convertView;
        }

        view.setImageResource(mImages[position]);
        return view;
    }
}
